Skip to content

Enable ONNX backend tests on [U]INT4 types in Cast#27326

Open
mcollinswisc wants to merge 3 commits intomicrosoft:mainfrom
mcollinswisc:cast_from_int4
Open

Enable ONNX backend tests on [U]INT4 types in Cast#27326
mcollinswisc wants to merge 3 commits intomicrosoft:mainfrom
mcollinswisc:cast_from_int4

Conversation

@mcollinswisc
Copy link
Contributor

Description

Support for [U]INT4 types in Cast op was added in:
51b678f

The comment on the skipped tests say they need ONNX 1.19. The ONNX submodule now points to 1.20.1:
de398c4

And if I run each of these they seem to work now:

$ ./build/Linux/RelWithDebInfo/onnx_test_runner cmake/external/onnx/onnx/backend/test/data/node/test_cast_*INT4*
Load Test Case: cast_UINT4_to_UINT8 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_UINT4_to_UINT8
Load Test Case: cast_UINT4_to_FLOAT16 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_UINT4_to_FLOAT16
Load Test Case: cast_UINT4_to_FLOAT in cmake/external/onnx/onnx/backend/test/data/node/test_cast_UINT4_to_FLOAT
Load Test Case: cast_INT4_to_INT8 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_INT4_to_INT8
Load Test Case: cast_INT4_to_FLOAT16 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_INT4_to_FLOAT16
Load Test Case: cast_INT4_to_FLOAT in cmake/external/onnx/onnx/backend/test/data/node/test_cast_INT4_to_FLOAT
Load Test Case: cast_FLOAT_to_UINT4 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_FLOAT_to_UINT4
Load Test Case: cast_FLOAT_to_INT4 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_FLOAT_to_INT4
Load Test Case: cast_FLOAT16_to_UINT4 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_FLOAT16_to_UINT4
Load Test Case: cast_FLOAT16_to_INT4 in cmake/external/onnx/onnx/backend/test/data/node/test_cast_FLOAT16_to_INT4
2026-02-11 22:48:10.236181534 [E:onnxruntime:Default, testcase_driver.cc:40 RunParallel] Running tests in parallel: at most 10 models at any time
2026-02-11 22:48:10.332387281 [E:onnxruntime:Default, testcase_driver.cc:62 RunModelsAsync] Running tests finished. Generating report
result: 
	Models: 10
	Total test cases: 10
		Succeeded: 10
		Not implemented: 0
		Failed: 0
	Stats by Operator type:
		Not implemented(0): 
		Failed:
Failed Test Cases:

Also removing an old TODO from
cd7112f

Motivation and Context

I was trying out INT4 support & ran into these comments. And expanding test coverage would be good.

.MayInplace(0, 0), // allocation planner will check input and output sizes match before inplacing
Cast);

// TODO(adrianlizarraga): Implement support for int4 and uint4.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrianlizarraga Does the support added since cd7112f meet the intention of this TODO?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant